import {
    Toast
  } from "vant";
  import cTitle from "components/title";
  export default {
    data() {
      return {
        corporate_name: '', //公司名称
        openingBank: '', //开户行
        subBranch: '', //支行
        bankAccountNumber: '', //银行账号
        remittingBank: '', //汇款银行
        RemittanceAccount: '', //汇款账号
        payer: '', //付款人
        PaymentAmount: '', //付款金额
        paymentvoucher: '', //付款凭证
        uploadUrl: "", //上传图片
      };
    },
  
    components: {
      cTitle
    },
    activated() {
      this.uploadUrl = this.fun.getRealUrl("upload.uploadPic", {});
      if (!localStorage.getItem("uid")) {
        this.$router.push(this.fun.getUrl("login"));
        return
      }
      this.getConfig();
      console.log(this.$route.params,'xiabngqing')
      var params = this.$route.params;
      this.remittingBank = params.bank; //汇款银行
      this.RemittanceAccount = params.bank_num; //汇款账号
      this.payer = params.user; //付款人
      this.PaymentAmount = params.money; //付款金额
      this.paymentvoucher = params.img; //付款凭证
      
    },
    computed: {
  
    },
    methods: {
      onCopy() {
          Toast({
              message: "复制成功",
              duration: 2000
            });
      },
      /*vant图片上传*/
      onRead(e, flag) {
        console.log(flag.name, "e, flag");
        let typeUpload = flag.name; //0 授权信息 1身份证正面 2身份证反面
        Toast.loading({
          message: "上传中",
          forbidClick: true
        });
        this.stopButton = true;
        let fd = new FormData();
  
        if (flag === true) {
          fd.append("file", e); // 第一个参数字符串可以填任意命名，第二个根据对象属性来找到file
        } else {
          fd.append("file", e.file); // 第一个参数字符串可以填任意命名，第二个根据对象属性来找到file
        }
        var That = this;
        axios
          .post(this.uploadUrl, fd, {
            headers: {
              "Content-Type": "multipart/form-data"
            }
          })
          .then(response => {
            var responseData = response.data;
            console.log(responseData, "responseData");
            if (responseData.result === 1) {
              Toast.clear();
              That.paymentvoucher = responseData.data.img_url;
            } else {
              Toast(responseData.msg);
            }
          })
          .catch(error => {
            console.log(error);
          });
      },
      getConfig() {
        $http.get("NiuTwo.huikuan_config", {}, "加载中").then((res) => {
          if (res.result == 1) {
            console.log(res, 'shuju_list')
            this.corporate_name = res.data.niuniu_gongsi;
            this.openingBank = res.data.niuniu_kaihu;
            this.subBranch = res.data.niuniu_zhanghao;
            this.bankAccountNumber = res.data.niuniu_zihang;
  
          }
        });
      },
  
  
    }
  };